﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace Venta
{
    public partial class Ventas : Form
    {
        public MySqlConnection conexio = new MySqlConnection();
        public MySqlCommand comando;
        public Ventas()
        {
            InitializeComponent();
            Conectar();
        }

        private void Ventas_Load(object sender, EventArgs e)
        {
            MySqlDataAdapter MyDA = new MySqlDataAdapter();
            string sqlSelectAll = "SELECT * from venta";
            MyDA.SelectCommand = new MySqlCommand(sqlSelectAll, conexio);
            DataTable table = new DataTable();
            MyDA.Fill(table);

            BindingSource bSource = new BindingSource();
            bSource.DataSource = table;

            dataGridView1.DataSource = bSource; 
        }
        private void Conectar()
        {
            try
            {
                conexio.ConnectionString = "Server=instance29023.db.xeround.com;Port=18932;Database=ventaboletos;Uid=petty; Pwd=petty;";
                conexio.Open();
            }
            catch
            {
                MessageBox.Show("No se realizo");
            }
        }
    }
}
